package com.guilin.system.service.impl;

import com.guilin.common.utils.DateUtils;
import com.guilin.domain.ForumCategory;
import com.guilin.mapper.ForumCategoryMapper;
import com.guilin.system.service.ForumCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 论坛分类Service业务层处理
 *
 * @author xiaoqi
 * @date 2025-06-20
 */
@Service
public class ForumCategoryServiceImpl implements ForumCategoryService
{
    @Autowired
    private ForumCategoryMapper forumCategoryMapper;

    /**
     * 查询论坛分类
     *
     * @param id 论坛分类主键
     * @return 论坛分类
     */
    @Override
    public ForumCategory selectForumCategoryById(Long id)
    {
        return forumCategoryMapper.selectForumCategoryById(id);
    }

    /**
     * 查询论坛分类列表
     *
     * @param forumCategory 论坛分类
     * @return 论坛分类
     */
    @Override
    public List<ForumCategory> selectForumCategoryList(ForumCategory forumCategory)
    {
        return forumCategoryMapper.selectForumCategoryList(forumCategory);
    }

    /**
     * 新增论坛分类
     *
     * @param forumCategory 论坛分类
     * @return 结果
     */
    @Override
    public int insertForumCategory(ForumCategory forumCategory)
    {
        forumCategory.setCreateTime(DateUtils.getNowDate());
        return forumCategoryMapper.insertForumCategory(forumCategory);
    }

    /**
     * 修改论坛分类
     *
     * @param forumCategory 论坛分类
     * @return 结果
     */
    @Override
    public int updateForumCategory(ForumCategory forumCategory)
    {
        forumCategory.setUpdateTime(DateUtils.getNowDate());
        return forumCategoryMapper.updateForumCategory(forumCategory);
    }

    /**
     * 批量删除论坛分类
     *
     * @param ids 需要删除的论坛分类主键
     * @return 结果
     */
    @Override
    public int deleteForumCategoryByIds(Long[] ids)
    {
        return forumCategoryMapper.deleteForumCategoryByIds(ids);
    }

    /**
     * 删除论坛分类信息
     *
     * @param id 论坛分类主键
     * @return 结果
     */
    @Override
    public int deleteForumCategoryById(Long id)
    {
        return forumCategoryMapper.deleteForumCategoryById(id);
    }
}
